@echo off

FOR /F "tokens=2* delims=	 " %%A IN ('%windir%\Sysnative\REG QUERY "hklm\SOFTWARE\JavaSoft\Java Development Kit" /v CurrentVersion') DO SET Country=%%B

FOR /F "tokens=2* delims=	 " %%A IN ('%windir%\Sysnative\REG QUERY "hklm\SOFTWARE\JavaSoft\Java Development Kit\%Country%" /v JavaHome') DO SET Country2=%%B

echo %Country2%
